﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Cfg;

namespace MyNHibernate
{
    public class TradSessionFactory
    {
        public static ISessionFactory GetCurrentFactory()
        {
            if (sessionFactory == null)
            {
                sessionFactory = CreateSessionFactory();
            }

            return sessionFactory;
        }

        private static ISessionFactory CreateSessionFactory()
        {
            return new Configuration().Configure().BuildSessionFactory();
        }

        private static ISessionFactory sessionFactory
        {
            get;
            set;
        }
    }
}
